package com.flying.refdata.repository.equity;

import com.flying.refdata.model.Quarter;
import com.flying.refdata.model.equity.EquityInfo;
import com.flying.refdata.model.equity.QuarterlyReport;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface QuarterlyReportRepository extends JpaRepository<QuarterlyReport, Long> {
    QuarterlyReport findTopByEquityInfoAndDiscloseDateBeforeOrderByDiscloseDateDesc(EquityInfo info, int date);

    @Query("select qr from QuarterlyReport qr where qr.equityInfo.code=?1 and qr.year=?2 and qr.quarter=?3")
    QuarterlyReport findByEquityCodeAndYearAndQuarter(String code, int year, Quarter quarter);
}
